// 创建全局的vuex
import Vue from 'vue';
import Vuex from 'vuex';
//运用”vuex-persistedstate”来对数据进行缓存
import createPersistedState from 'vuex-persistedstate'


Vue.use(Vuex);

const module = {
  state:{
     imgSrc:'',
     user_id:'',
     singist:''
  },
  // 把getters看成是计算属性
  getters:{

  },
  //mutations存放修改state中值的事件
  mutations:{
    chuan(state,its){
       state.imgSrc = its;
    },
    chage(state,userid){
       state.user_id = userid
    },
    getsin(state,txt){
      state.singist = txt;
    }
  },
  plugins:[createPersistedState()]
};

const store = new Vuex.Store(module);

export default store;
